package com.sijibao.gather.event;

import java.io.Serializable;

import com.alibaba.fastjson.JSON;

public class DriverCertifyRequestEvent extends Event implements Serializable
{
	private static final long serialVersionUID = -6391724972172649607L;

	/**
	 * 司机用户编码
	 */
	private String userCode;
	/**
	 * 认证请求类型 1：初次申请 2：更新申请
	 * 
	 */
	private RequestType requestType;
	/**
	 * 创建时间
	 */
	private long createTime;
	/**
	 * 定位经度
	 */
	private double longitude;
	/**
	 * 定位纬度
	 */
	private double latitude;
	/**
	 * 客户端版本号
	 */
	private int clientVersion;
	/**
	 * 手机型号如：小米
	 */
	private String mobileModel;
	/**
	 * 设备号
	 */
	private String deviceCode;

	public DriverCertifyRequestEvent(String userCode, RequestType requestType,
			long createTime, double longitude, double latitude,
			int clientVersion, String mobileModel, String deviceCode)
	{
		super(DriverCertifyRequestEvent.class.getName());
		this.userCode = userCode;
		this.requestType = requestType;
		this.createTime = createTime;
		this.longitude = longitude;
		this.latitude = latitude;
		this.clientVersion = clientVersion;
		this.mobileModel = mobileModel;
		this.deviceCode = deviceCode;
	}
	
	public enum RequestType
	{
		FIRST(1),
		UPDATE(2);
		private int value;
		
		private RequestType(int value)
		{
			this.value=value;
		}
		
		public int value()
		{
			return this.value;
		}
		
		public int getValue()
		{
			return this.value;
		}
	}

	public double getLongitude()
	{
		return longitude;
	}

	public void setLongitude(double longitude)
	{
		this.longitude = longitude;
	}

	public double getLatitude()
	{
		return latitude;
	}

	public void setLatitude(double latitude)
	{
		this.latitude = latitude;
	}

	public int getClientVersion()
	{
		return clientVersion;
	}

	public void setClientVersion(int clientVersion)
	{
		this.clientVersion = clientVersion;
	}

	public String getMobileModel()
	{
		return mobileModel;
	}

	public void setMobileModel(String mobileModel)
	{
		this.mobileModel = mobileModel;
	}

	public String getDeviceCode()
	{
		return deviceCode;
	}

	public void setDeviceCode(String deviceCode)
	{
		this.deviceCode = deviceCode;
	}

	public String getUserCode()
	{
		return userCode;
	}

	public void setUserCode(String userCode)
	{
		this.userCode = userCode;
	}

	public RequestType getRequestType()
	{
		return requestType;
	}

	public void setRequestType(RequestType requestType)
	{
		this.requestType = requestType;
	}

	public long getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(long createTime)
	{
		this.createTime = createTime;
	}

	@Override
	public String toString()
	{
		return "DriverCertifyRequestEvent [userCode=" + userCode
				+ ", requestType=" + requestType + ", createTime=" + createTime
				+ ", longitude=" + longitude + ", latitude=" + latitude
				+ ", clientVersion=" + clientVersion + ", mobileModel="
				+ mobileModel + ", deviceCode=" + deviceCode + "]";
	}
	
	public static void main(String[] agre)
	{
		String json="";
		System.out.println(json=JSON.toJSONString(new DriverCertifyRequestEvent("ddddd", RequestType.UPDATE,
				0, 0, 0,
				0, "dddddd", "sssssssss")));
		
		System.out.println(JSON.parseObject(json, DriverCertifyRequestEvent.class));
		
	}

}
